import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  main: {
    plugins: [externalizeDepsPlugin()]
  },
  preload: {
    plugins: [externalizeDepsPlugin()]
  },
  renderer: {
    resolve: {
      alias: {
        '@renderer': resolve('src/renderer/src')
      }
    },
    plugins: [vue()],
    // 打包时，注释掉
    // server: {
    //   proxy: {
    //     '/api': {
    //       target: 'http://127.0.0.1:7888',
    //       changeOrigin: true, // 允许跨域
    //       ws: true, // 允许websocket代理
    //       rewrite: (path) => path.replace(/^\/api/, "")
    //     }
    //   }
    // }
  }
})
